<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			p{
				font-size: 24px;
				height: 60px;
				line-height: 30px;
				overflow: hidden;
				width: 200px;
			}
		</style>
	</head>
	<body>
		<p title="我要这铁棒有何用">我要这铁棒有何用我要这铁棒有何用我要这铁棒有何用我要这铁棒有何用我要这铁棒有何用我要这铁棒有何用我要这铁棒有何用我要这铁棒有何用我要这铁棒有何用我要这铁棒有何用我要这铁棒有何用我要这铁棒有何用我要这铁棒有何用我要这铁棒有何用我要这铁棒有何用我要这铁棒有何用</p>
	</body>
	<script type="text/javascript">
		var p = document.querySelector("p");
		var str = p.innerHTML;
		
		
		//使用重复字符时不宜用下列写法
//		var str1 = str.substring(15);
//		var str2 = str.replace(str.substring(15),"...");


		var str1 = str.substring(0,5) + "...";
		p.innerHTML = str1;
		
		
		
		
		
		
		
	</script>
</html>
